import API from './index'

export const getHomeDate = () => {};
// 登录
export function login(data) {
  const url = 'api/login'
  return API.postJson(url, data)
}
// 注册
export function register(data) {
  const url = 'api/register'
  return API.postJson(url, data)
}
// 获取首页数据
export function getData(data) {
  const url = 'doc/home'
  return API.get(url, data)
}
// 获取首页模块数据
export function getHomeModal(data) {
  const url = 'doc/'+data
  return API.get(url)
}
// 获取广告
export function getAd(data) {
  const url = 'feature/advert/list/'
  return API.get(url,data)
}
// 获取分类导航数据
export function getCNList(data) {
  const url = 'feature/industry/list/'
  return API.get(url,data)
}

export function getMunu(name) {
  // const url = '/menu'
  const url = `/menu/${name}`;
  return API.get(url)
}

// 登录
// 搜索
export const getArea = (params) => {
  return API.get('/area/getArea', params)
}

//获取区域
export const getRegionArea = (params = {}) => {
  return API.get('/feature/regionarea/getRegionArea', params)
}
//获取搜索类型
export const getAticleType = (params = {}) => {
  return API.get('/channel/getChannel', params)
}
// s搜索接口

export const searchDoc = (params) => {
  return API.get('/doc/search', params)
}
export const getDocDetail = (params) => {
  return API.get(`/doc/${params.id}`)
}
export const collectDoc = (params) => {
  return API.post(`/feature/projeccollect/add`, params)
}

// 策略管理
// 项目列表
export function getProjectList(data) {
  const url = '/project'
  return API.get(url, data)
}

// 创建项目 添加项目
export function creatProject(data) {
  const url = '/project/addProject'
  return API.post(url, data)
}

// 编辑项目状态
export function editProject(data) {
  const url = '/project/update'
  return API.put(url, data)
}

// 删除项目
export function deleteProject(id) {
  const url = '/project/delete/' + id
  return API.delete(url, '')
}

// 策略管理
// 策略列表
export function getStrategyList(data) {
  const url = '/strategy'
  return API.get(url, data)
}

// 策略下拉列表
export function queryStrategyList(data) {
  const url = '/strategy/queryList'
  return API.get(url, data)
}

// 修改优先级或价格
export function updatePriOrPrice(data) {
  const url = `/strategy/updatePriOrPrice/${data.type}`;
  return API.post(url, data);
}

// 创建策略 添加策略
// POST /strategy/addStrategy
export function creatStrategy(data) {
  const url = '/strategy/addStrategy'
  return API.post(url, data)
}

// 编辑策略
// POST /strategy/updateStrategy
export function editStrategy(data) {
  const url = '/strategy/updateStrategy'
  return API.post(url, data)
}

// 删除策略
// DELETE /strategy/deleteBatch/{ids}
export function deleteStrategy(id) {
  const url = '/strategy/deleteBatch/' + id
  return API.delete(url)
}

// 导出策略 导出表格
// GET /strategy/excel
export function exportStrategy(_url) {
  const url = '/strategy/excel/' + _url
  return API.down(url)
}

export function exportReport(_url) {
  const url = '/ssp/report/excel/' + _url
  return API.down(url)
}

// 发布、暂停策略
// DELETE /strategy/deleteBatch/{ids}/{type}
export function startStrategy(id, type) {
  const url = `/strategy/deleteBatch/${id}/${type}`
  return API.delete(url)
}

// 条件筛选-查询媒体级联
// GET /strategy/cascade
export function getCascadeMeun() {
  const url = `/strategy/cascade`
  return API.get(url)
}

export function getNewCascadeMeun() {
  const url = `/strategy/new-cascade`
  return API.get(url)
}

// 条件筛选-查询广告源
// GET /ssp/accept/list/{accessType}
export function getAcceptName(accessType) {
  const url = `/ssp/accept/list/` + accessType
  return API.get(url)
}

// 创建策略-获取过滤规则列表
// GET /put-filter
export function getFilter(data) {
  const url = `/put-filter`
  return API.get(url, data)
}

// 根据id查询策略详情
// GET /strategy/{id}
export function getStrategyInfo(id) {
  const url = `/strategy/${id}`
  return API.get(url)
}

// 媒体
// 获取媒体列表
// GET /ssp/media
export function getMediaList(data) {
  const url = `/ssp/media`
  return API.get(url, data)
}

// 删除媒体列表
// DELETE /ssp/media/{mediaId}
export function deleteMedia(id) {
  const url = '/ssp/media/' + id
  return API.delete(url, '')
}

// 创建媒体  添加媒体
// PATCH /ssp/media
export function creatMedia(data) {
  const url = '/ssp/media'
  return API.postJson(url, data)
  // return API.patch(url,data)
}

//  修改媒体
// PUT /ssp/media
export function updateMedia(data) {
  const url = '/ssp/media/edit'
  return API.postJson(url, data)
}

// 获取媒体媒体账号
// GET /user
export function getUser(data) {
  const url = '/user'
  return API.get(url, data)
}

// 获取对照关系
// GET /ssp/accept/list
export function getMapRelation() {
  const url = '/ssp/accept/list'
  return API.get(url)
}

// 广告位
// 广告位列表
// GET /ssp/flow/adslot
export function getAdList(data) {
  const url = '/ssp/flow/adslot'
  return API.get(url, data)
}

// 获取媒体info
// GET /ssp/media/{mediaId}
export function getMediaInfo(mediaId) {
  const url = '/ssp/media/' + mediaId
  return API.get(url)
}

// 删除广告位
// DELETE /ssp/flow/adslot/{adslotId}
export function deleteAd(adslotId) {
  const url = '/ssp/flow/adslot/' + adslotId
  return API.delete(url)
}

// 添加广告位
// POST /ssp/flow/adslot
export function creatAd(data) {
  const url = '/ssp/flow/adslot/'
  return API.postJson(url, data)
}

// 修改广告位
// POST /ssp/flow/adslot/edit
export function editAd(data) {
  const url = '/ssp/flow/adslot/edit/'
  return API.postJson(url, data)
}

// 获取广告位对照关系
// POST ssp/accept/service/list
export function getAdmapList(data) {
  const url = '/ssp/accept/service/list/'
  return API.get(url, data)
}

// 根据id获取广告位详情
// GET /ssp/flow/adslot/{adslotId}
export function getAdInfo(adslotId) {
  const url = '/ssp/flow/adslot/' + adslotId
  return API.get(url)
}

// 下载广告位
export function exportAdInfo(param) {
  const url = `/ssp/flow/adslot/excel${param}`;
  return API.down(url);
}

export function getAdTypeStyle() {
  const url = '/ssp/flow/adslot/adslotType-style';
  return API.get(url);
}

// 上传广告位图示
export function adslotUrlUpload() {
  const url = '/ssp/common/image';
  return API.get(url);
}

export function checkDistribute(data) {
  return API.get('/ssp/flow/adslot/check', data);
}

// 广告样式
// 广告样式列表
// GET /ssp/flow/adslot-style
export function getAdslotList(data) {
  const url = '/ssp/flow/adslot-style'
  return API.get(url, data)
}

// 广告位样式下拉
// 广告位样式下拉
// GET /ssp/flow/adslot-style/style-map
export function getStyleList() {
  const url = '/ssp/flow/adslot-style/style-map'
  return API.get(url)
}

// 标记下拉
// 标记下拉
// GET /ssp/flow/adslot-style/mark-map
export function getMarkList() {
  const url = '/ssp/flow/adslot-style/mark-map'
  return API.get(url)
}

// 添加广告样式
// POST /ssp/flow/adslot-style
export function creatAdSolt(data) {
  const url = '/ssp/flow/adslot-style/'
  return API.post(url, data)
}

// 修改广告样式
// POST /ssp/flow/adslot-style/edit
export function editAdSolt(data) {
  const url = '/ssp/flow/adslot-style/edit/'
  return API.post(url, data)
}

// 删除广告位
// DELETE /ssp/flow/adslot-style/{styleId}
export function deleteAdSolt(styleId) {
  const url = '/ssp/flow/adslot-style/' + styleId
  return API.delete(url)
}

// 获取广告样式info
// GET /ssp/flow/adslot-style/{styleId}
export function getAdslotInfo(styleId) {
  const url = '/ssp/flow/adslot-style/' + styleId
  return API.get(url)
}

// 激励视频奖励方式
// 激励视频奖励方式列表
export function getVideoRewardList(data) {
  const url = '/ssp/reward/list';
  return API.get(url, data);
}

// 激励视频奖励方式删除
export function deleteVideoReward(id) {
  const url = `/ssp/reward/delete/${id}`;
  return API.delete(url);
}

// 获取单个奖励方式信息
export function getVideoReward(id) {
  const url = `/ssp/reward/query/${id}`;
  return API.get(url);
}

// 新增奖励方式
export function createVideoReward(data) {
  const url = '/ssp/reward/add';
  return API.post(url, data);
}

// 编辑奖励方式
export function editVideoReward(data) {
  const url = 'ssp/reward/update';
  return API.put(url, data);
}

// 获取大转盘
export function getCampaigns(data) {
  const url = '/ssp/reward/getCampaigns';
  return API.get(url, data);
}

// 获取奖品list
export function getGifts(data) {
  const url = '/ssp/reward/getGifts';
  return API.get(url, data);
}

// 获取大转盘
// 创建策略页面获取奖励方式列表
export function videoRewardList(data) {
  const url = '/strategy/getRewardInfos';
  return API.get(url, data);
}

// 流量过滤规则
// 流量过滤规则列表
// GET /put-filter
export function getRuleList(data) {
  const url = '/put-filter'
  return API.get(url, data)
}

// 新增 流量过滤规则
// POST /put-filter/add
export function creatRule(data) {
  const url = '/put-filter/add/'
  return API.post(url, data)
}

export function updateRule(data) {
  const url = '/put-filter/update/'
  return API.post(url, data)
}

// 删除 流量过滤规则
// DELETE /put-filter/delete/{id}
export function deleteRule(id) {
  const url = '/put-filter/delete/' + id
  return API.delete(url)
}

// 查询省
export function getProvinceList() {
  const url = '/area/province';
  return API.get(url)
}

// 查询市
// GET /area/city/{parentId}
export function getCityList(parentId) {
  const url = `/area/city/${parentId || 0}`; // 0 查所有的市
  return API.get(url)
}

// 查询省市
// GET /area/area-list/
export function getProvincesList() {
  const url = `/area/area-list/`
  return API.get(url)
}

// 查询版本列表
// GET /put-filter/getVersionList
export function getVerList() {
  const url = '/put-filter/getVersionList/'
  return API.get(url)
}

// 查询方案列表
// GET /put-filter/getPlanList
export function getPlanList() {
  const url = '/put-filter/getPlanList/'
  return API.get(url)
}

// 查询渠道号列表
// GET /put-filter/getChannelList
export function getRuleChannelList() {
  const url = '/put-filter/getChannelList/'
  return API.get(url)
}

// 查询渠道详情
// GET /put-filter/detail/{id}
export function getFilterInfo(id) {
  const url = '/put-filter/detail/' + id
  return API.get(url)
}

// 渠道集
// 渠道集列表
// GET /channel/set
export function getChannelList(data) {
  const url = '/channel/set'
  return API.get(url, data)
}

// 新增渠道集
// POST /channel/set/add
export function creatChannel(data) {
  const url = '/channel/set/add/'
  return API.post(url, data)
}

// 删除渠道集
// POST /channel/set/delete
export function deleteChannel(data) {
  const url = '/channel/set/delete'
  return API.post(url, data)
}

// 用户集
// GET /userFeature 查询用户特征列表
export function getUserList(data) {
  const url = '/userFeature'
  return API.get(url, data)
}

// 新增用户集
// POST /userFeature/add
export function creatUser(data) {
  const url = '/userFeature/add'
  return API.post(url, data)
}

// 修改用户集
// PUT /userFeature/update
export function editUser(data) {
  const url = '/userFeature/update/'
  return API.put(url, data)
}

// 删除用户集
// DELETE /userFeature/delete/{id}
export function deleteUser(id) {
  const url = '/userFeature/delete/' + id
  return API.delete(url)
}

// 发布用户集
// DELETE /userFeature/release/{id}
export function publishUser(id) {
  const url = '/userFeature/release/' + id
  return API.delete(url)
}

// 获取用户集
// GET /userFeature/selectOne/{id}
export function getUserFeature(id) {
  const url = '/userFeature/selectOne/' + id
  return API.get(url)
}

// 广告源管理   AdManage
// 广告源列表
// GET /ssp/accept
export function getAdManageList(data) {
  const url = '/ssp/accept'
  return API.get(url, data)
}

// 新增广告源
// POST /ssp/accept
export function creatAdManage(data) {
  const url = '/ssp/accept'
  return API.post(url, data)
}

// 修改广告源
// POST /ssp/accept/edit
export function editAdManage(data) {
  const url = '/ssp/accept/edit'
  return API.post(url, data)
}

// 删除广告源
// DELETE /ssp/accept/{acceptId}
export function deleteAdManage(acceptId) {
  const url = '/ssp/accept/' + acceptId
  return API.delete(url)
}

// 查询广告源
// GET /ssp/accept/{acceptId}
export function getAdManageInfo(acceptId) {
  const url = '/ssp/accept/' + acceptId
  return API.get(url)
}

// 数据报表
// 获取广告数据列表
// POST /ssp/report
export function getReportList(data) {
  const url = '/ssp/report'
  return API.post(url, data)
}

// 获取广告UV数据列表
export function getUvReportList(data) {
  const url = '/ssp/uv'
  return API.postJson(url, data)
}

// 导出广告UV数据列表
export function exportUvReportList(_url) {
  const url = '/ssp/uv/excel' + _url;
  return API.down(url)
}

// 获取媒体广告数据列表
export function getMediaReportList(data) {
  const url = '/ssp/report/mediaReport'
  return API.post(url, data)
}

// 第三方监测
// 第三方监测列表
// GET /third-monitor
export function getMonitorList(data) {
  const url = '/third-monitor'
  return API.get(url, data)
}

// 第三方监测列表
// DELETE /third-monitor/delete/{ids}
export function deleteMonitor(ids) {
  const url = '/third-monitor/delete/' + ids
  return API.delete(url)
}

// 新增监测
// POST /third-monitor/addThirdMonitor
export function creatMonitor(data) {
  const url = '/third-monitor/addThirdMonitor'
  return API.post(url, data)
}

// 编辑监测
// PUT /third-monitor/update
export function updateMonitor(data) {
  const url = '/third-monitor/update'
  return API.post(url, data)
}

// 获取所属行业一级列表
export function getIndustry() {
  const url = '/industry-category/first';
  return API.get(url);
}

// 获取所属行业二级列表
export function getIndustrySecond(parentId) {
  const url = `/industry-category/second/${parentId}`;
  return API.get(url);
}

// 重置密码
export function resetPassword(data) {
  const url = `/dsp/advertiser/reset/${data.id}/${data.password}`;
  return API.put(url);
}

// 导出广告主
export function exportAd(param) {
  const url = `/dsp/advertiser/advertiser-export${param}`;
  return API.down(url);
}

// 导出代理商
export function exportAgent(param) {
  const url = `/dsp/advertiser/agent-export${param}`;
  return API.down(url);
}

// 校验账户名是否重复
export function checkAdName(name) {
  const url = `/dsp/advertiser/checkName/${name}`;
  return API.get(url);
}

// 广告主模块
// 广告主列表
export function getAdOwnerList(data) {
  const url = '/dsp/advertiser';
  return API.get(url, data);
}

// 获取单个广告主详情
export function getAdOwnerDetail(id) {
  const url = `/dsp/advertiser/${id}`;
  return API.get(url);
}

// 创建广告主
export function createAdOwner(data) {
  const url = '/dsp/advertiser';
  return API.postJson(url, data);
}

// 编辑广告主
export function editAdOwner(data) {
  const url = '/dsp/advertiser/update';
  return API.postJson(url, data);
}

// 冻结广告主
export function frozenAdOwner(id, status) {
  const url = `/dsp/advertiser/status/${id}/${status}`;
  return API.put(url);
}

// 代理商模块
// 代理商列表
export function getAgentList(data) {
  const url = '/dsp/advertiser/agent';
  return API.get(url, data);
}

// 获取单个代理商详情
export function getAgentDetail(id) {
  const url = `/dsp/advertiser/${id}`;
  return API.get(url);
}

// 创建代理商
export function createAgent(data) {
  const url = '/dsp/advertiser';
  return API.postJson(url, data);
}

// 编辑代理商
export function editAgent(data) {
  const url = '/dsp/advertiser/update';
  return API.postJson(url, data);
}

// 冻结代理商
export function frozenAgent(id, status) {
  const url = `/dsp/advertiser/status/${id}/${status}`;
  return API.put(url);
}

// 广告主审核
export function adOwnerExamine(data) {
  const url = `/dsp/advertiser/audit-status/${data.id}/${data.auditStatus}`;
  return API.put(url, data);
}

// 财务管理模块
// 广告主充值列表
export function getAdownerRechargeList(data) {
  const url = '/dsp/advertiser';
  return API.get(url, data);
}

// 广告主／代理商 充值、退款
export function transact(data) {
  const url = '/dsp/financial/transaction';
  return API.post(url, data);
}

// 广告主／代理商 交易明细
export function transactDetail(data) {
  const url = '/dsp/financial/transaction';
  return API.get(url, data);
}

// 广告主／代理商 财务报告
export function financeReport(data) {
  const url = '/dsp/financial/settlement';
  return API.get(url, data);
}

// 广告主／代理商 消耗报告
export function costReport(data) {
  const url = '/dsp/financial/report';
  return API.get(url, data);
}

// 广告主／代理商 财务报告
export function getAdverids() {
  const url = '/dsp/financial/report/adverIds';
  return API.get(url);
}

// 广告主／代理商 财务报告
export function costReportExcel(__url) {
  const url = '/dsp/financial/report/excel' + __url;
  return API.down(url);
}

// 设置模块
// 消耗比例设置list
export function getConsumerRatis(data) {
  const url = '/dsp/consumer-ratio';
  return API.get(url, data);
}

// 修改消耗比例
export function editConsumerRatis(data) {
  const url = '/dsp/consumer-ratio';
  return API.post(url, data);
}

// 白名单列表
export function getWhiteList(data) {
  const url = '/adver/white-list';
  return API.get(url, data);
}

// 添加白名单
export function addWhite(data) {
  const url = '/adver/white-list/add';
  return API.postJson(url, data);
}

// 删除白名单
export function deleteWhite(data) {
  const url = `/adver/white-list/delete/${data.id}`;
  return API.get(url, data);
}

// 查询账户
export function getWhiteInfo(data) {
  const url = `/adver/white-list/info/${data.name}`;
  return API.get(url, data);
}

export function getCodes() {
  const url = '/ssp/flow/adslot/position-codes';
  return API.get(url);
}

export function getApiAccepts() {
  const url = '/ssp/flow/adslot/api-accepts';
  return API.get(url);
}

export function getAppAccepts() {
  const url = '/ssp/media/accept/app-accepts';
  return API.get(url);
}

export function getMediaApiAccpetMap(accpetId) {
  const url = '/ssp/media/app-accept/' + accpetId;
  return API.get(url);
}

export function getCommonMap(type) {
  const url = '/ssp/common/' + type;
  return API.get(url);
}

export function batchUpdate(data) {
  const url = `/strategy/batch-update/${data.type}`;
  return API.post(url, data);
}

export function dspLogin(data) {
  const url = '/dsp/user/login';
  return API.get(url, data);
}

// 上传
export function upload(data = {}, callback1) {
  const url = '/ssp/common/image';
  return API.upload(url, data, callback1);
}


/*个人中心*/